<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue</title>
</head>

<body>
<div id='example'>
    <!--<span v-once>这个将不会改变: {{ msg }}</span>-->
    <!--<div v-html="rawHtml"></div>-->
    <!--<button>{{showMsg()}}</button>-->
    <div>{{ fullName }}</div>
</div>
</body>
</html>
<script src="../js/vue.js"></script>
<script src="../node_modules/lodash/lodash.js"></script>
<script src="../node_modules/axios/dist/axios.js"></script>
<script>
    var vm = new Vue({
        el: '#example',
        data: {
            firstName: '321',
            lastName: 'Bar'
        },
        computed: {
            fullName:{
                get: function () {
                    return this.firstName + ' ' + this.lastName
                },
                set: function (newValue) {
                    var names = newValue.split(' ');
                    this.firstName = names[0];
                    this.lastName = names[names.length - 1]
                }
            }
//            fullName: function () {
//                return this.firstName + ' ' + this.lastName
//            }
//            fullName: {
//                get: function () {
//                    return this.firstName + ' ' + this.lastName
//                },
//                set: function (newValue) {
//                    var names = newValue.split(' ');
//                    this.firstName = names[0];
//                    this.lastName = names[names.length - 1]
//                }
//            }
        }
    });

</script>